(function(){if(window.BXMainMailForm)return;var e=function(t,i,o){if(e.__forms[t])return e.__forms[t];this.id=t;this.fields=i;this.options=o;e.__forms[this.id]=this};e.__forms={};e.getForm=function(t){return e.__forms[t]};e.prototype.getField=function(e){for(var t=this.fields.length;t-- >0;){if(this.fields[t].params.name==e)return this.fields[t]}return false};e.prototype.onSubmit=function(e){var t=this;var i=BX.findChildByClassName(this.formWrapper,"main-mail-form-footer",false)||this.footerNode;var o=BX.findChildByClassName(i,"main-mail-form-submit-button",true);if(o.disabled)return BX.PreventDefault();this.editor.OnSubmit();var a=i.cloneNode(true);Array.prototype.forEach.call(a.querySelectorAll("[id]"),(function(e){e.removeAttribute("id")}));BX(this.formId+"_dummy_footer").appendChild(a);e=e||window.event;BX.onCustomEvent(this,"MailForm:submit",[this,e]);if(!e.defaultPrevented&&e.returnValue!==false){BX.addClass(o,"ui-btn-wait");o.disabled=true;o.offsetHeight;if(this.options.submitAjax){BX.ajax.submitAjax(this.htmlForm,{url:this.htmlForm.getAttribute("action"),method:"POST",dataType:"json",onsuccess:function(e){o.disabled=false;BX.removeClass(o,"ui-btn-wait");BX.onCustomEvent(t,"MailForm:submit:ajaxSuccess",[t,e])},onfailure:function(e){o.disabled=false;BX.removeClass(o,"ui-btn-wait");BX.onCustomEvent(t,"MailForm:submit:ajaxFailure",[t,e])}});return BX.PreventDefault(e)}}};e.prototype.showError=function(e){var t=BX.findChildByClassName(this.formWrapper,"main-mail-form-error",true);var i=new BX.UI.Alert({text:e,inline:true,closeBtn:true,animate:true,color:BX.UI.Alert.Color.DANGER});t.innerHTML="";t.append(i.getContainer());this.initScrollable();if(this.__scrollable){var o=BX.pos(this.__scrollable);var a=BX.pos(this.formWrapper);var r=BX.pos(t);if(o.top>r.top-10-this.__scrollable.scrollTop)this.__scrollable.scrollTop=r.top-10;else if(o.bottom<a.bottom-10-this.__scrollable.scrollTop)this.__scrollable.scrollTop=a.bottom-10-o.bottom}};e.prototype.init=function(){var t=this;if(this.__inited)return;this.formId="main_mail_form_"+this.id;this.formWrapper=BX(this.formId);this.htmlForm=BX.findParent(this.formWrapper,{tag:"form"});this.postForm=LHEPostForm.getHandler(this.formId+"_editor");this.editor=BXHtmlEditor.Get(this.formId+"_editor");this.editorInited=false;this.timestamp=(new Date).getTime();this.quoteNodeId=this.formId+"_quote_"+this.timestamp.toString(16);this.signatureNodeId=this.formId+"_signature_"+this.timestamp.toString(16);BX.addCustomEvent(this,"MailForm::from::change",BX.proxy((function(e,t){if(!BX.type.isString(t)){t="";var i;var o=BX(e.fieldId+"_value");if(o){i=o.value}if(i&&e.params&&BX.type.isArray(e.params.mailboxes)&&BX.type.isNotEmptyObject(e.params.signatures)){for(var a in e.params.mailboxes){if(e.params.mailboxes.hasOwnProperty(a)){if(e.params.mailboxes[a].formated===i){if(BX.type.isNotEmptyString(e.params.signatures[e.params.mailboxes[a].formated])){t=e.params.signatures[e.params.mailboxes[a].formated]}else if(BX.type.isNotEmptyString(e.params.signatures[e.params.mailboxes[a].email])){t=e.params.signatures[e.params.mailboxes[a].email]}else if(BX.type.isNotEmptyString(e.params.signatures[""])){t=e.params.signatures[""]}break}}}}}this.insertSignature(t)}),this));this.initFields();this.initFooter();BX.bind(this.htmlForm,"submit",this.onSubmit.bind(this));this.__inited=true;BX.onCustomEvent(e,"MailForm:init:"+this.id,[this])};e.prototype.initScrollable=function(){if(!this.__scrollable){if(document.scrollingElement)this.__scrollable=document.scrollingElement}if(!this.__scrollable){if(document.documentElement.scrollTop>0||document.documentElement.scrollLeft>0)this.__scrollable=document.documentElement;else if(document.body.scrollTop>0||document.body.scrollLeft>0)this.__scrollable=document.body}if(!this.__scrollable){window.scrollBy(1,1);if(document.documentElement.scrollTop>0||document.documentElement.scrollLeft>0)this.__scrollable=document.documentElement;else if(document.body.scrollTop>0||document.body.scrollLeft>0)this.__scrollable=document.body;window.scrollBy(-1,-1)}};e.prototype.initFields=function(){for(var e=0,i;e<this.fields.length;e++){this.fields[e]=new t(this,this.fields[e]);i=this.fields[e].fieldId;this.fields[i]=this.fields[e]}var o=BX(this.formId+"_fields_footer");var a=BX(this.formId+"_fields_ext_footer");var r=[].concat(BX.findChildrenByClassName(o,"main-mail-form-field-button",true)||[]).concat(BX.findChildrenByClassName(a,"main-mail-form-field-button",true)||[]);for(var e=0,i;e<r.length;e++){i=r[e].getAttribute("data-target");if(typeof this.fields[i]!="undefined"){this.fields[i].__switch=r[e];BX.bind(r[e],"click",this.fields[i].unfold.bind(this.fields[i]))}}};e.prototype.initFooter=function(){var e=this;var t=BX.findChildByClassName(this.formWrapper,"main-mail-form-footer-wrapper",true);var i=BX.findChildByClassName(t,"main-mail-form-footer",false);this.footerNode=i;var o=BX.findChildrenByClassName(i,"main-mail-form-footer-button",true);for(var a in o){(function(t){BX.bind(t,"click",(function(){BX.onCustomEvent(e,"MailForm:footer:buttonClick",[e,t]);if(BX.hasClass(t,"main-mail-form-submit-button"))BX.submit(e.htmlForm)}))})(o[a])}var r=function(){if(BX.hasClass(i,"main-mail-form-footer-fixed")){BX.removeClass(i,"main-mail-form-footer-fixed-hidden");BX.removeClass(i,"main-mail-form-footer-fixed");i.style.left="";i.style.width="";t.style.height="";t.appendChild(i)}};var n=function(){e.initScrollable();if(e.formWrapper.offsetHeight>0&&e.__scrollable){var o=BX.pos(e.__scrollable);var a=BX.pos(e.formWrapper);if(o.bottom<a.bottom-10-e.__scrollable.scrollTop){i.style.left=a.left-o.left-e.__scrollable.scrollLeft+"px";i.style.width=e.formWrapper.offsetWidth+"px";if(!BX.hasClass(i,"main-mail-form-footer-fixed")){if(o.bottom<BX.pos(t).top-e.__scrollable.scrollTop)BX.addClass(i,"main-mail-form-footer-fixed-hidden");t.style.height=t.offsetHeight+"px";BX.addClass(i,"main-mail-form-footer-fixed");document.body.appendChild(i)}var n=BX.findChildByClassName(e.formWrapper,"main-mail-form-editor-wrapper",true);if(o.bottom<BX.pos(n).top+i.offsetHeight-e.__scrollable.scrollTop)BX.addClass(i,"main-mail-form-footer-fixed-hidden");else BX.removeClass(i,"main-mail-form-footer-fixed-hidden");return}}r()};var s=new MutationObserver((function(){e.initScrollable();if(e.__scrollable){var t=[e.__scrollable.scrollHeight,e.__scrollable.scrollTop].join(":");if(e.__scrollable.__lastState!=t){e.__scrollable.__lastState=t;n()}}}));var l=function(){setTimeout((function(){if(!e.__footerMonitoring){e.__footerMonitoring=true;s.observe(document.body,{attributes:true,childList:true,subtree:true});BX.bind(window,"resize",n);BX.bind(window,"scroll",n);BX.addCustomEvent(window,"AutoResizeFinished",n);n()}}),400)};var d=function(){e.__footerMonitoring=false;s.disconnect();BX.unbind(window,"resize",n);BX.unbind(window,"scroll",n);BX.removeCustomEvent(window,"AutoResizeFinished",n);r()};BX.addCustomEvent(this,"MailForm:show",l);BX.addCustomEvent(this,"MailForm:hide",d);if(this.formWrapper.offsetHeight>0)l()};e.prototype.insertSignature=function(e){if(this.editorInited){this.editor.synchro.Sync();var t=this.editor.GetIframeDoc().getElementById(this.signatureNodeId);if(!BX.type.isNotEmptyString(e)){if(t){BX.remove(t)}return}var i="--<br />"+e;if(t){t.innerHTML=i}else{t=BX.create("div",{attrs:{id:this.signatureNodeId},html:i});var o=this.editor.GetIframeDoc().getElementById(this.quoteNodeId);if(o){o.parentNode.insertBefore(t,o)}else{BX.append(t,this.editor.GetIframeDoc().body)}t.parentNode.insertBefore(document.createElement("BR"),t)}this.editor.synchro.FullSyncFromIframe()}else{BX.addCustomEvent(this,"MailForm::editor::init",BX.proxy((function(){this.insertSignature(e)}),this))}};var t=function(e,t){this.form=e;this.params=t;this.fieldId=this.form.formId+"_"+this.params.id;this.init()};t.prototype.init=function(){this.params.__row=BX(this.fieldId);if(t.__types[this.params.type]&&t.__types[this.params.type].init)t.__types[this.params.type].init(this);if(this.params.menu){var e=this;var i=BX.findChildByClassName(this.params.__row,"main-mail-form-field-value-menu-ext-button",true);BX.addCustomEvent(this.form,"MailForm::editor:click",(function(){var t=BX.PopupMenu.getMenuById(e.fieldId+"-menu-ext");if(t)t.close()}));BX.addCustomEvent("onSubMenuShow",(function(){var t=this.menuWindow;while(t.parentMenuWindow)t=t.parentMenuWindow;if(e.fieldId+"-menu-ext"==t.id)BX.addClass(this.subMenuWindow.popupWindow.popupContainer,"main-mail-form-field-value-menu-ext-content")}));BX.bind(i,"click",(function(){BX.onCustomEvent(e.form,"MailForm:field:setMenuExt",[e.form,e]);const t=[];e.__menuExt.forEach((function(e){if(e.text===undefined||e.value===null){return}if(e.items.length===0){t.push({id:e.value,entityId:e.text,title:e.text,customData:{field:e.value},tabs:["recents"]});return}t.push({id:e.value,entityId:e.text,title:e.text,tabs:["recents"],children:e.items.map((t=>{if(t.value===undefined||t.text===undefined){return}return{supertitle:e.text,id:t.value,entityId:t.text,title:t.text,customData:{field:t.value},tabs:["recents"]}}))})}));const i=new BX.UI.EntitySelector.Dialog({targetNode:this,width:500,height:300,multiple:false,dropdownMode:true,showAvatars:false,compactView:true,enableSearch:true,items:t,events:{"Item:onBeforeSelect":t=>{t.preventDefault();e.insert(t.getData().item.id)}}});i.show()}))}};t.prototype.setMenuExt=function(e){this.__menuExt=e};t.prototype.insert=function(e){if(t.__types[this.params.type]&&t.__types[this.params.type].insert)t.__types[this.params.type].insert(this,e)};t.prototype.setValue=function(e,i){if(t.__types[this.params.type]&&t.__types[this.params.type].setValue)t.__types[this.params.type].setValue(this,e,i)};t.prototype.show=function(){this.params.hidden=false;BX.addClass(this.fieldId,"main-mail-form-drop-animation");BX(this.fieldId).style.display=this.params.folded?"none":"";this.__switch.style.display=this.params.folded?"":"none"};t.prototype.hide=function(){this.params.hidden=true;BX(this.fieldId).style.display="none";this.__switch.style.display="none";BX.removeClass(this.fieldId,"main-mail-form-drop-animation")};t.prototype.fold=function(){this.params.folded=true;if(!this.params.hidden)this.__switch.style.display="";BX(this.fieldId).style.display="none";BX.removeClass(this.fieldId,"main-mail-form-drop-animation")};t.prototype.unfold=function(){this.params.folded=false;if(!this.params.hidden){BX.addClass(this.fieldId,"main-mail-form-drop-animation");BX(this.fieldId).style.display=""}this.__switch.style.display="none"};t.__types={list:{},text:{},from:{},rcpt:{},editor:{},files:{}};t.__types["list"].init=function(e){BX.addCustomEvent(e.form,"MailForm::editor:click",(function(){var t=BX.PopupMenu.getMenuById(e.fieldId+"-menu");if(t)t.close()}));var t=BX.findChildByClassName(e.params.__row,"main-mail-form-field-value-menu",true);BX.bind(t,"click",(function(){var i=BX(e.fieldId+"_value");var o=function(e,o){i.value=e;BX.adjust(t,{html:o})};var a=function(e,t){o(t.options.value,t.text);t.menuWindow.close()};var r=[];if(!e.params.required){r.push({text:BX.util.htmlspecialchars(e.params.placeholder),title:e.params.placeholder,value:"",onclick:a});r.push({delimiter:true})}for(var n in e.params.list){r.push({text:BX.util.htmlspecialchars(e.params.list[n]),title:e.params.list[n],value:n,onclick:a})}BX.PopupMenu.show(e.fieldId+"-menu",t,r,{className:"main-mail-form-field-value-menu-content",offsetLeft:40,angle:true,closeByEsc:true})}))};t.__types["from"].init=function(e){BX.addCustomEvent(e.form,"MailForm::editor:click",(function(){var t=BX.PopupMenu.getMenuById(e.fieldId+"-menu");if(t)t.close()}));BX.onCustomEvent(e.form,"MailForm::from::change",[e]);var t=BX.findChildByClassName(e.params.__row,"main-mail-form-field-value-menu",true);BX.bind(t,"click",(function(){var i=BX(e.fieldId+"_value");BXMainMailConfirm.showList(e.fieldId,t,{required:e.params.required,placeholder:e.params.placeholder,selected:i.value,callback:function(o,a){i.value=o;BX.adjust(t,{html:BX.util.strip_tags(a)});BX.onCustomEvent(e.form,"MailForm::from::change",[e])}})}))};t.__types["rcpt"].init=function(e){var t=BX.findChildByClassName(e.params.__row,"main-mail-form-field-rcpt-item-more",true);var i=BX.findChildByClassName(e.params.__row,"main-mail-form-field-value-wrapper",true);var o=BX.findChildByClassName(e.params.__row,"main-mail-form-field-rcpt-add-link",true);var a=BX(e.fieldId+"_fvalue");e.selector=e.fieldId+"-selector";var r=function(r,n,s,l,d,m){if(!e.params.multiple){var f=BX.SocNetLogDestination.getSelected(e.selector);for(var u in f){if(u!=r.id||f[u]!=n)BX.SocNetLogDestination.deleteItem(u,f[u],e.selector)}}var p=document.createElement("SPAN");p.setAttribute("data-id",r.id);BX.addClass(p,"main-mail-form-field-rcpt-item");i.insertBefore(p,t.parentNode);p.appendChild(BX.create("INPUT",{props:{type:"hidden",name:e.params.name+"[]",value:JSON.stringify(r)}}));r.showEmail="N";if(e.params.email&&r.email&&r.email.length>0&&r.email!=r.name){r=BX.clone(r);r.name=r.name+" &lt;"+r.email+"&gt;"}BX.SocNetLogDestination.BXfpSelectCallback({item:r,type:n,varName:"dummy_"+e.params.name,bUndeleted:false,containerInput:p,valueInput:a,formName:d,tagInputName:o,tagLink1:e.params.placeholder,tagLink2:e.params.placeholder});if("init"==m){var c=9;var h=BX.findChildrenByClassName(i,"main-mail-form-field-rcpt-item",false);if(h.length>c+1){for(var u=c;u<h.length;u++)h[u].style.display="none";t.setAttribute("title",t.getAttribute("title").replace(/-?\d+/,h.length-c));t.parentNode.style.display=""}}};var n=function(r,n,s,l){var d=BX.findChild(i,{attribute:{"data-id":r.id}},false);BX.SocNetLogDestination.BXfpUnSelectCallback.apply({formName:l,inputContainerName:d,inputName:a,tagInputName:o,tagLink1:e.params.placeholder,tagLink2:e.params.placeholder},[r]);if(d&&d.parentNode==i){if(!BX.findChildByClassName(d,"feed-add-post-destination"))i.removeChild(d)}var m=9;var f=0;var u=BX.findChildrenByClassName(i,"main-mail-form-field-rcpt-item",false);for(var p=0;p<u.length;p++){if(u[p].offsetHeight>0)f++}if(f<u.length&&(f<m||u.length<=m+1)){for(var p=0;p<u.length;p++){if(u[p].offsetHeight>0)continue;u[p].style.display="";f++;if(f>=Math.min(m,u.length)&&u.length>m+1)break}t.setAttribute("title",t.getAttribute("title").replace(/-?\d+/,u.length-m));if(f>=u.length)t.parentNode.style.display="none"}};if(e.form.options.version<2){var s={name:e.selector,searchInput:a,bindMainPopup:{node:i,offsetTop:"5px",offsetLeft:"15px"},bindSearchPopup:{node:i,offsetTop:"5px",offsetLeft:"15px"},callback:{select:r,unSelect:n,openDialog:BX.delegate(BX.SocNetLogDestination.BXfpOpenDialogCallback,{inputBoxName:a.parentNode,inputName:a,tagInputName:o}),closeDialog:function(){BX.onCustomEvent(e.form,"MailForm:field:rcptSelectorClose",[e.form,e]);BX.SocNetLogDestination.BXfpCloseDialogCallback.apply({inputBoxName:a.parentNode,inputName:a,tagInputName:o})},openSearch:BX.delegate(BX.SocNetLogDestination.BXfpOpenDialogCallback,{inputBoxName:a.parentNode,inputName:a,tagInputName:o})},items:{},itemsLast:{},itemsSelected:{},destSort:{}};if(e.params.selector){for(var l in e.params.selector)s[l]=e.params.selector[l]}BX.SocNetLogDestination.init(s);BX.bind(a,"keydown",BX.delegate(BX.SocNetLogDestination.BXfpSearchBefore,{formName:e.selector,inputName:a}));BX.bind(a,"keyup",BX.delegate(BX.SocNetLogDestination.BXfpSearch,{formName:e.selector,inputName:a,tagInputName:o}));BX.bind(a,"paste",BX.defer(BX.SocNetLogDestination.BXfpSearch,{formName:e.selector,inputName:a,tagInputName:o,onPasteEvent:true}));BX.bind(a,"blur",BX.delegate(BX.SocNetLogDestination.BXfpBlurInput,{inputBoxName:a.parentNode,tagInputName:o}));BX.bind(i,"click",(function(t){BX.SocNetLogDestination.openDialog(e.selector);BX.PreventDefault(t)}))}BX.bind(t,"click",(function(e){var t=BX.findChildrenByClassName(i,"main-mail-form-field-rcpt-item",false);for(var o=0;o<t.length;o++)t[o].style.display="";this.parentNode.style.display="none";BX.PreventDefault(e)}))};t.__types["editor"].init=function(e){var t=e.form.postForm;var o=e.form.editor;if(e.params.value===null||e.params.value===undefined)e.params.value="";e.quoteNode=document.createElement("DIV");var a=document.createElement("DIV");a.setAttribute("id",e.form.quoteNodeId);a.innerHTML=e.params.value;e.quoteNode.appendChild(a);e.quoteNode.__folded=e.form.options.foldQuote;BX.onCustomEvent(t.eventNode,"OnShowLHE",["justShow"]);BX.addClass(o.dom.cont,"main-mail-form-editor");o.dom.toolbarCont.style.opacity="inherit";BX.addCustomEvent(o,"OnIframeClick",(function(){if(e.form.options.version<2){BX.SocNetLogDestination.abortSearchRequest();BX.SocNetLogDestination.closeSearch();BX.SocNetLogDestination.closeDialog()}BX.onCustomEvent(e.form,"MailForm::editor:click",[])}));var r=BX.findChildByClassName(e.form.htmlForm,"main-mail-form-quote-button",true);var n=function(){if(e.quoteNode.__folded){e.quoteNode.__folded=false;e.setValue(o.GetContent(),{quote:true,signature:false});o.Focus(false);BX.hide(r.parentNode.parentNode||r.parentNode)}};BX.bind(r,"click",n);var s=function(){if(o.GetViewMode()!="wysiwyg"){BX.removeCustomEvent(o,"OnSetViewAfter",s);n()}};BX.addCustomEvent(o,"OnSetViewAfter",s);if(t.parser){t.parser.disk_file.regexp=/(bxacid):(n?\d+)/gi}o.phpParser.AddBxNode("diskfile0",{Parse:function(t,i){var a=o.GetIframeDoc().getElementById(i)||BX.findChild(e.quoteNode,{attr:{id:i}},true);var t=o.GetBxTag(i);if(a&&t){var r=document.createElement("DIV");a=a.cloneNode(true);r.appendChild(a);if(a.tagName.toUpperCase()=="IMG"){var n="";a.setAttribute("data-bx-orig-src",a.getAttribute("src"));a.setAttribute("src",n);return r.innerHTML.replace(n,"bxacid:"+t.fileId)}return r.innerHTML}return"[ "+t.value+" ]"}});BX.addCustomEvent(t.eventNode,"OnFileUploadRemove",(function(t){o.synchro.Sync();for(i in o.bxTags){if(o.bxTags[i].fileId&&o.bxTags[i].fileId==t){var a=o.GetIframeDoc().getElementById(o.bxTags[i].id);if(a&&a.parentNode)a.parentNode.removeChild(a);var a=BX.findChild(e.quoteNode,{attr:{id:o.bxTags[i].id}},true);if(a&&a.parentNode)a.parentNode.removeChild(a);delete o.bxTags[i]}}o.synchro.FullSyncFromIframe()}));BX.addCustomEvent(o,"OnCreateIframeAfter",(function(){e.setValue("",{quote:true,signature:true});e.form.editorInited=true;BX.onCustomEvent(e.form,"MailForm::editor::init",[e])}));BX.addCustomEvent(e.form,"MailForm:show",(function(){e.form.editor.CheckAndReInit();e.form.editor.ResizeSceleton()}));BX.addCustomEvent(e.form,"MailForm:hide",(function(){e.form.editor.SaveContent()}));BX.addCustomEvent(e.form,"MailForm:submit",(function(){var t=o.GetContent();if(e.quoteNode.__folded)t+=o.Parse(e.quoteNode.innerHTML,true,false);BX(e.fieldId+"_value").value=t}))};t.__types["from"].setValue=function(e,t){var i=BX(e.fieldId+"_value");var o=BX.findChildByClassName(e.params.__row,"main-mail-form-field-value-menu",true);if(!t.trim()){if(!e.params.required){i.value="";BX.adjust(o,{html:""})}BX.onCustomEvent(e.form,"MailForm::from::change",[e,""]);return}if(e.params.mailboxes&&e.params.mailboxes.length>0){var a=new RegExp("[-/\\^$*+?.()|[]{}]","g");for(var r in e.params.mailboxes){var n=new RegExp("(^|<)"+e.params.mailboxes[r].email.replace(a,"\\$&")+"(>|$)","i");if(t.trim().match(n)){i.value=t;BX.adjust(o,{html:BX.util.htmlspecialchars(t)});BX.onCustomEvent(e.form,"MailForm::from::change",[e]);break}}}};t.__types["rcpt"].setValue=function(e,t){if(e.form.options.version<2){var i=BX.SocNetLogDestination.getSelected(e.selector);for(var o in i)BX.SocNetLogDestination.deleteItem(o,i[o],e.selector)}if(t&&BX.type.isPlainObject(t)){if(e.form.options.version<2){for(var o in t){if(t.hasOwnProperty(o)){BX.SocNetLogDestination.obItemsSelected[e.selector][o]=t[o];BX.SocNetLogDestination.runSelectCallback(o,t[o],e.selector,false,"init")}}}BX.onCustomEvent("BX.Main.SelectorV2:reInitDialog",[{selectorId:e.params.id,selectedItems:BX.clone(t)}])}};t.__types["text"].insert=function(e,t){var i=BX(e.fieldId+"_value");if(typeof i.selectionStart!="undefined"){var o={start:i.selectionStart,end:i.selectionEnd};i.value=i.value.substr(0,o.start)+t+i.value.substr(o.end);i.selectionStart=i.selectionEnd=o.start+t.length}else{i.value=i.value+t}i.focus()};t.__types["text"].setValue=function(e,t){var i=BX(e.fieldId+"_value");i.value=t};t.__types["editor"].insert=function(e,t){var i=e.form.editor;if(i.synchro.IsFocusedOnTextarea()){i.textareaView.WrapWith("","",t);if(i.textareaView.element&&typeof i.textareaView.element.selectionStart!="undefined")i.textareaView.element.selectionStart=i.textareaView.element.selectionEnd}else{i.selection.GetRange().deleteContents();i.InsertHtml(t)}i.Focus()};t.__types["editor"].setValue=function(e,t,i){var o=e.form.postForm;var a=e.form.editor;if(t.length>0){for(var r in o.controllers){if(!o.controllers.hasOwnProperty(r))continue;var n=o.controllers[r];if(n.storage!="disk")continue;if(!n.values)break;for(var s in n.values){if(n.values.hasOwnProperty(s)&&n.values[s].src)t=t.replace("bxacid:"+s,n.values[s].src+"&__bxacid="+s)}break}}if(i&&i.signature){a.synchro.Sync();var l=a.GetIframeDoc().getElementById(e.form.signatureNodeId);if(l){var d=document.createElement("div");d.appendChild(l.cloneNode(true));t+=d.innerHTML}}if(i&&i.quote&&!e.quoteNode.__folded)t+=e.quoteNode.innerHTML;a.SetContent(t,true);var m=/[&?]__bxacid=(n?\d+)/;var f={IMG:"src",A:"href"};for(var u in f){var p=a.GetIframeDoc().getElementsByTagName(u);for(var c=0;c<p.length;c++){var h=p[c].getAttribute(f[u])?p[c].getAttribute(f[u]).match(m):false;if(h){p[c].removeAttribute("id");p[c].setAttribute(f[u],p[c].getAttribute(f[u]).replace(m,""));a.SetBxTag(p[c],{tag:"diskfile0",fileId:h[1]})}}}a.synchro.FullSyncFromIframe()};t.__types["files"].setValue=function(e,t){var i=e.form.postForm;i.controllerInit("show");for(var o in i.controllers){if(!i.controllers.hasOwnProperty(o))continue;var a=i.controllers[o];if(a.storage!="disk")continue;if(!a.handler)break;t=BX.clone(t);if(a.values){for(var r=0;r<t.length;r++){if(a.values[t[r].id])t.splice(r--,1)}}a.handler.selectFile({},{},t);break}};window.BXMainMailForm=e})();
//# sourceMappingURL=script.map.js